﻿<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">

<head>
    <jsp:include page="/common.jsp"></jsp:include>
</head>

<body class="navbar-top">
<div class="modal-shiftfix">
    <jsp:include page="/menu.jsp"></jsp:include>
    <div class="container-fluid main-content">
        <div class="widget-container fluid-height clearfix mwi1200">
            <div class="heading clearfix">
                <i class="icon-reorder"></i> 修改联系人 <i class="icon-reply pull-right" onclick="history.go(-1);"></i>
            </div>
            <div class="widget-content padded clearfix">
                <form id="actionform" class="form-horizontal" action="view/customerManage/contacts/index.jsp"
                      method="post">
                    <div class="form-group field-contacts-name required">
                        <label class="control-label col-sm-2" for="contacts-name">姓名</label>

                        <div class="col-sm-8">
                            <input type="text" id="contacts-name" class="form-control" name="name"
                                   value="${linkMan.name}"
                                   maxlength="20" placeholder="姓名">
                        </div>
                        <div class="help-block help-block-error"></div>
                    </div>
                    <div class="form-group field-contacts-sex required">
                        <label class="control-label col-sm-2" for="contacts-sex">性别</label>

                        <div class="col-sm-8">
                            <div id="contacts-sex">
                                <label class="label-radio inline">
                                    <input type="radio" name="sex" value="1" id="nanId"> <span
                                        class="custom-radio"></span>男</label>
                                <label class="label-radio inline">
                                    <input type="radio" name="sex" value="0" id="nvID"> <span
                                        class="custom-radio"></span>女</label>
                            </div>
                        </div>
                        <div class="help-block help-block-error"></div>
                    </div>
                    <div class="form-group field-contacts-honorific required">
                        <label class="control-label col-sm-2" for="contacts-honorific">尊称</label>

                        <div class="col-sm-8">
                            <input type="text" id="contacts-honorific" class="form-control" name="nickname"
                                   value="${linkMan.nickname}" maxlength="20" placeholder="尊称">
                        </div>
                        <div class="help-block help-block-error"></div>
                    </div>
                    <div class="form-group field-contacts-post">
                        <label class="control-label col-sm-2" for="contacts-post">职位</label>

                        <div class="col-sm-8">
                            <input type="text" id="contacts-post" class="form-control" name="position" value="${linkMan.position}"
                                   maxlength="20" placeholder="职位">
                        </div>
                        <div class="help-block help-block-error"></div>
                    </div>
                    <div class="form-group field-contacts-mobile required">
                        <label class="control-label col-sm-2" for="contacts-mobile">手机</label>

                        <div class="col-sm-8">
                            <input type="text" id="contacts-mobile" class="form-control" name="phonenum"
                                   value="${linkMan.phonenum}" placeholder="手机" maxlength="11">
                        </div>
                        <div class="help-block help-block-error"></div>
                    </div>
                    <div class="form-group field-contacts-email required">
                        <label class="control-label col-sm-2" for="contacts-email">电子邮箱</label>

                        <div class="col-sm-8">
                            <input type="text" id="contacts-email" class="form-control" name="email"
                                   value="${linkMan.email}" placeholder="电子邮箱">
                        </div>
                        <div class="help-block help-block-error"></div>
                    </div>
                    <div class="form-group field-contacts-qq">
                        <label class="control-label col-sm-2" for="contacts-qq">QQ</label>

                        <div class="col-sm-8">
                            <input type="text" id="contacts-qq" class="form-control" name="qq"
                                   value="${linkMan.qq}" placeholder="QQ">
                        </div>
                        <div class="help-block help-block-error"></div>
                    </div>
                    <div class="form-group field-contacts-remarks">
                        <label class="control-label col-sm-2" for="contacts-remarks">备注</label>

                        <div class="col-sm-8">
                            <textarea id="contacts-remarks" class="form-control" name="remarks"
                                      maxlength="255" placeholder="备注">${linkMan.remarks}</textarea>
                        </div>
                        <div class="help-block help-block-error"></div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 control-label"></label>

                        <div class="col-lg-10">
                            <input type="hidden" id="linkManid" name="linkMainId" value="${linkMan.linkMainId}">
                            <button type="button" class="btn btn-primary" onclick="updatLinkMan()">修改</button>
                            <button type="button" class="btn btn-default" onClick="history.go(-1);">返回</button>
                        </div>
                        <!-- /.col -->
                    </div>
                </form>
            </div>
        </div>

    </div>
</div>
</body>
<script type="text/javascript">
    function updatLinkMan() {
        let data = $("#actionform").serialize();
        $.ajax({
            type: 'post',
            url: 'LinkManServlet?method=updateLinkMan',
            data: data,
            cache: false,
            sync: true,
            dataType: 'json',
            success: function (json) {
                if (!json.flag) {
                    //显示错误消息
                    alert(json.msg);
                    return;
                }
                //新增成功  查询最新数据
                window.location.href = 'LinkManServlet?method=getAllLinkMan';
            }, error: function () {
                alert("请求失败");
                return false;
            }
        });
    }
</script>
</html>
